<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <a href="#" onclick="sendMessage('a')">发送数据 a</a><br/>
    
    <a href="#" onclick="showMessages()">显示数据</a><br/>
    <div id="requestText" style="color:red"></div><br/>
    <div id="requestText1" style="color:green"></div>

<script>
    var request = new XMLHttpRequest();
    function sendMessage(value){
        request.onreadystatechange = ()=>{
           if(request.readyState == 4){
           console.info(`状态码：${request.status}`);
           console.info(`响应数据：${request.responseText}`);

        }
       }
		request.open("get",`http://localhost:8080/iotweb_test/loadclass/a/say`);
        request.send();
    }

    function showMessage(eleId,value){
        var ele = document.getElementById(eleId);
        ele.innerText=value
    }
    
    function showMessages(){
      showMessage('requestText',`${request.responseText}`)
      showMessage('requestText1',`${request.responseText}`)
    }    

</script>


</body>

</html>